@using Dyn.News.ViewModels;
@{
    Style.Require("DynEcommerce");
    var categoriesVM = Model.WidgetVM as List<CategoryViewModel>;        
}

<div class="categories-widget">
    @if (categoriesVM != null)
    {
        foreach (var cat in categoriesVM)
        {
    <div class="grid-item">
        @if (Model.CheckUser)
        {
        <div class="manage-actions">
            <a href="@Url.ItemEditUrl(cat.CategoryPart)">@T("Edit")</a>
        </div>
        }
        <div class="image">
            @if(cat.CurrentMedia.PublicUrl != null)
            {
           <a href="@Url.ItemDisplayUrl(cat.CategoryPart)"> <img src="@Url.Content(cat.CurrentMedia.Thumbnail.PublicUrl)" /></a>
            }
        </div>
        <div class="info">
            <h3><a href="@Url.ItemDisplayUrl(cat.CategoryPart)">@cat.CategoryPart.Name</a></h3>
            <p>@cat.CategoryPart.Description</p>
        </div>
    </div>
        }
    }
    <div style="clear:both"></div>
</div>